import request from '@/utils/request2'
export const GetLogin = (code) => request.post('/login', {
    principal: code
})

export const orderCount = () => request.get('/p/myOrder/orderCount')

export const collectData = () => request.get('/p/user/collection/count')

export const getOrderList = ({ current, size, status }) => request.get('/p/myOrder/myOrder', {
    current, size, status
})

export const getAddressList = () => request.get('/p/address/list')

export const pushAddressList =({ addr, addrId, area, areaId, city, cityId, mobile, province, provinceId, receiver, userType }) =>
    request.post('/p/address/addAddr',{ addr, addrId, area, areaId, city, cityId, mobile, province, provinceId, receiver, userType
 })

export const getRegionData = (pid) => request.get('/p/area/listByPid', { pid })

export const getAddressUserInfo = (addrId) => request.get(`/p/address/addrInfo/${addrId}`)

export const deleteAddress = (addrId) => request.DELETE(`/p/address/deleteAddr/${addrId}`)

export const setDefaultAddress = (addrId) => request.put(`/p/address/defaultAddr/${addrId}`)

export const putAddress =({ addr, addrId, area, areaId, city, cityId, mobile, province, provinceId, receiver, userType }) =>
    request.put('/p/address/updateAddr',{ addr, addrId, area, areaId, city, cityId, mobile, province, provinceId, receiver, userType
 }) 

